'use strict';

module.exports = app => {
    const { Sequelize, model } = app

    const Model = model.define('minaUser', {
        id:{
            type: Sequelize.STRING.BINARY,
            defaultValue: Sequelize.UUIDV1,
            primaryKey: true
        },
        openid: {
            type: Sequelize.STRING(50),
            allowNull: false,
            unique: true,
        },
        unionid: {
            type: Sequelize.STRING(50),
        },
        nickName: {
            type: Sequelize.STRING(50),
        },
        avatarUrl: {
            type: Sequelize.STRING,
        },
        gender: {
            type: Sequelize.STRING(1),
        },
        city: {
            type: Sequelize.STRING(20),
        },
        province: {
            type: Sequelize.STRING(20),
        },
        country: {
            type: Sequelize.STRING(20),
        },
        language: {
            type: Sequelize.STRING(20),
        },
    }, {
        freezeTableName: true,
        tableName: 'mina_user',
        timestamps: true,
        paranoid: true,
    })

    return Model
}